﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DoubanApi.Helper;

namespace DoubanApi.Models
{
    [Serializable]
    public class MovieModel : DoubanModel
    {

        public MovieModel()
        {
            Writer = Director = Cast = Movie_Type = Country = Language = Pubdate = Movie_Duration = Aka = new DoubanListCollection<string>();

        }

       public  string _Title;
        /// <summary>
        /// 电影标题
        /// </summary>
        public string Title
        {
            get
            {
                if (!string.IsNullOrEmpty(_Title))
                {
                    return _Title;
                }

                if (Aka.Count > 0)
                {
                    return Aka[0];
                }
                return _Title;
            }
            set
            {
                _Title = value;
            }
        }

        /// <summary>
        /// 导演
        /// </summary>
        public DoubanListCollection<string> Writer { get; internal set; }

        /// <summary>
        /// 编剧
        /// </summary>
        public DoubanListCollection<string> Director { get; internal set; }

        /// <summary>
        /// 主演
        /// </summary>
        public DoubanListCollection<string> Cast { get; internal set; }

        /// <summary>
        /// 类型
        /// </summary>
        public DoubanListCollection<string> Movie_Type { get; internal set; }


        /// <summary>
        /// 制片国家/地区
        /// </summary>
        public DoubanListCollection<string> Country { get; internal set; }


        /// <summary>
        /// 语言
        /// </summary>
        public DoubanListCollection<string> Language { get; internal set; }


        /// <summary>
        /// 上映日期
        /// </summary>
        public DoubanListCollection<string> Pubdate { get; internal set; }

        
        /// <summary>
        /// 电影时长
        /// </summary>
        public DoubanListCollection<string> Movie_Duration { get; internal set; }

        /// <summary>
        /// 又名
        /// </summary>
        public DoubanListCollection<string> Aka { get; internal set; }

        /// <summary>
        /// 剧情简介
        /// </summary>
        public string Summary { get; set; }

        /// <summary>
        /// 剧情简介(缩略)
        /// </summary>
        public string SummaryThumb
        {
            get
            {
                if (string.IsNullOrEmpty(Summary))
                    return "";

                if (Summary.Length > 20)
                {
                    return Summary.Substring(0, 17) + "...";
                }
                else
                {
                    return Summary;
                }
            }
        }

        /// <summary>
        /// 预告地址
        /// </summary>
        public MoviePreviewModel Preview { get; internal set; }

        public DoubanListCollection<PreviewImageModel> PreviewImages { get; internal set; }
    }
}
